#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

using ll = long long;
int find(int x, vector<int> &father, vector<ll> &dist)
{
	if (father[x] != x) {
                int tmp = father[x];
		father[x] = find(father[x], father, dist);
                dist[x] += dist[tmp];
	}
	return father[x];
}

int merge(int x, int y, ll val, vector<int> &father, vector<ll> &dist)
{
	int fx = find(x, father, dist);
	int fy = find(y, father, dist);
	if (fx != fy) {
		father[fx] = fy;
                dist[fx] = val + dist[y] - dist[x];
		return 1;
	}
	return 0;
}

int main()
{
	int n, m, q;
	cin >> n >> m >> q;
	vector<int> father(n + 2, 0);
	vector<ll> dist(n + 2, 0);
	iota(father.begin(), father.end(), 0);

	for (int i = 0; i < m; i++) {
		ll x, y, val;
		cin >> x >> y >> val;
		merge(x, y + 1, val, father, dist);
	}

	for (int i = 0; i < q; i++) {
		ll x, y;
		cin >> x >> y;
                y++;
		int fx = find(x, father, dist);
		int fy = find(y, father, dist);
		if (fx == fy) {
			cout << dist[x] - dist[y] << endl;
		} else {
			cout << "UNKNOWN" << endl;
		}                
	}
	return 0;
}       